//
//  UIImageView+Circle.m
//  Kartor
//
//  Created by Kratos on 14-5-4.
//  Copyright (c) 2014年 cn.cstonline. All rights reserved.
//

#import "UIImageView+Circle.h"

@implementation UIImageView (Circle)
-(void)showAsCircle
{
    [self showAsCircleWithBorder:0 borderColor:NULL];
}

-(void)showAsCircleWithBorder:(CGFloat)borderWidth borderColor:(CGColorRef)borderColor
{
    self.layer.cornerRadius = CGRectGetWidth(self.bounds)/2.f;
    self.layer.masksToBounds = NO;
    self.clipsToBounds = YES;
    self.contentMode = UIViewContentModeScaleAspectFill;
    self.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
    
    if (borderWidth > 0) {
        self.layer.borderWidth = borderWidth;
    }
    
    if (borderColor) {
        self.layer.borderColor = borderColor;
    }
}
@end
 